package fr.ydelouis.swipelistviewsample.adapter;

import java.util.ArrayList;
import java.util.List;

import android.content.Context;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import fr.ydelouis.swipelistviewsample.MyItem;
import fr.ydelouis.swipelistviewsample.MyItemView;
import fr.ydelouis.swipelistviewsample.element.NotificationItem;
import fr.ydelouis.swipelistviewsample.view.NotificationView;

public class NotificationAdapter extends ArrayAdapter<NotificationItem> {

	public NotificationAdapter(Context context, ArrayList<NotificationItem> items) {
		super(context, 0, items);
	}

	@Override
	public View getView(int position, View view, ViewGroup parent) {
		NotificationView notiView;
		if (view != null && view instanceof NotificationView)
			notiView = (NotificationView) view;
		else
			notiView = new NotificationView(getContext());

		NotificationItem myItem = getItem(position);
		notiView.bind(myItem);

		return notiView;
	}
}
